import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        StringBuffer sb = new StringBuffer(in.next());
        int cur = 0;
        while(cur < sb.length()) {
            if(cur+1 < sb.length() && sb.charAt(cur) == sb.charAt(cur+1)) {
                sb.delete(cur,cur+2);
                cur--;
                if(cur < 0) cur = 0;
            } else {
                cur++;
            }
        }
        System.out.println(sb.length()==0?0:sb.toString());
    }
}